]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
background: Reload animation on timezone changes
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 2 Dec 2015 15:44:05 +0000 (07:44 -0800)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 2 Dec 2015 16:18:39 +0000 (17:18 +0100)
Animated backgrounds are based on a start time in local time - in case
of a timezone change, that time is no longer accurate. To fix, we need
to either make BGSlideShow aware of timezone changes (and notify us to
update the animation), or just reload the animation - timezone changes
should be a rare event, so go with the simpler second option.

https://bugzilla.gnome.org/show_bug.cgi?id=758939

js/ui/background.js

index e2f9a473b976f4daa55f24bbfa009f26ad26518a..5db1e6c8c87ee342b491020e4254efcb8e3e19b7 100644 (file)
@@ -247,6 +247,13 @@ const Background = new Lang.Class({
         this._cancellable = new Gio.Cancellable();
         this.isLoaded = false;
 
+        this._clock = new GnomeDesktop.WallClock();
+        this._timezoneChangedId = this._clock.connect('notify::timezone',
+            Lang.bind(this, function() {
+                if (this._animation)
+                    this._loadAnimation(this._animation.file);
+            }));
+
         this._settingsChangedSignalId = this._settings.connect('changed', Lang.bind(this, function() {
                                             this.emit('changed');
                                         }));
@@ -265,6 +272,10 @@ const Background = new Lang.Class({
         }
         this._fileWatches = null;
 
+        if (this._timezoneChangedId != 0)
+            this._clock.disconnect(this._timezoneChangedId);
+        this._timezoneChangedId = 0;
+
         if (this._settingsChangedSignalId != 0)
             this._settings.disconnect(this._settingsChangedSignalId);
         this._settingsChangedSignalId = 0;